When editing source files, indentation automatically inserts spaces. For someone like
me who is "a little pedantic", these trailing spaces hanging around are less than
ideal. And there are many other situations where trailing spaces can be left "hanging
around".
What would be good is for jEdit to be a little smarter about spaces. These features
should probably be optional, or implemented via a plugin.
Suggestion 1: "virtual spaces"
When auto-indenting, don't actually insert spaces immediately. Just position the cursor
at the appropriate column. _If_ the user then types something on that line, _then_
spaces can actually be inserted. _If_ the user doesn't type something on that line
(e.g. move away from that line, or hit Enter for the next line), then no spaces are
left on that line.
Suggestion 2: automatic removal of trailing spaces
When a user has edited a line, and then moves away from that line, automatically remove
trailing spaces on that line.
Note: Don't change lines that the user hasn't edited. The WhiteSpace plugin has an
option to remove trailing spaces when a file is saved. But this has the disadvantage
that when editing a file in a multiple-developer scenario, and other developers _do_
leave trailing spaces, and using version control, a particular check-in of edits will
potentially show many lines changed simply due to trailing spaces being removed. But
I just want to be tidy within the scope of my own edits, and not fiddle with spaces
throughout the rest of the file.
Submitted | cmcqueen1975 - 2008-05-16 - 00:53:27z | Assigned | nobody |
---|---|---|---|
Priority | 5 | Category | WhiteSpace |
Status | Open | Group | None |
Resolution | None | Visibility | No |
2008-05-16 - 09:05:08z kpouer |
Logged In: YES user_id=285591 Originator: NO Hi, did you try the Whitespace plugin ? It has an option to remove trailing whitespace before saving files |
---|---|
2008-05-16 - 18:02:25z rschwenn |
Logged In: YES user_id=1486645 Originator: NO There are related requests: #1574625, #1869411. |
2008-05-16 - 21:38:29z k_satoda |
Logged In: YES user_id=1483238 Originator: NO I have not used the The WhiteSpace plugin's option because the same reason Craig said. Now I got inspired Suggestion 2 and made a quick implementation in a few lines of bsh. if (textArea.isEditable()) { int lineIndex = textArea.getCaretLine(); textArea.insertEnterAndIndent(); textArea.getBuffer().removeTrailingWhiteSpace(new int [] {lineIndex}); } else { textArea.getToolkit().beep(); } Binding this to ENTER, I'm feeling happy for now. I'll continue testing this in real work. Having this as an action in WhiteSpace plugin may be a solution for this request? |
2008-05-30 - 02:15:21z ezust |
Logged In: YES user_id=935841 Originator: NO Moving this to Plugin Feature Requests, and changing subject to be related to WhiteSpace plugin. If someone woudl like to enhance the WhiteSpace plugin to include these missing features, please submit a patch to the plugin patches tracker. |
2012-02-10 - 20:04:07z jarekczek |
Suggestion 1 seems unrealistic and would rather be a core feature. The only open case is now the second suggestion. Yeah, it would be a safe feature that could be always on. |